package com.wbf.demo.service;

import com.wbf.demo.mapper.UserMapper;
import com.wbf.demo.mobile.User;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserService {
    @Resource
    private UserMapper userMapper;

    /**
     * cacheable
     * value-redisKey，key-动态参数
     * #60-失效时间60秒
     * @param userId
     * @return
     */
    @Cacheable(value = "getUserInfo#60",key = "#userId")
    public User getUserInfo(int userId) {
        return userMapper.getUserInfo(userId);
    }
}
